﻿#pragma once

#define  WND_HISCUVE_ID			19200

// CResultRecordView 窗体视图
//////////////////////////////////////////////////////////////
//
//	历史查询
//
//
// 2021-11-11
//
/////////////////////////////////////////////////////////////////
#include "HisChromG.h"
#include "GridCtrl\\GridCtrl.h"
#include "BtnST.h"
#include "public\\cdib.h"

struct CHROM_RESULT				//积分结果
{
	long	lTime;				//时间
	float	dLagDepth;			//迟到井深
	float	dTG;				//
	float	dC1;				//
	float	dC2;				//
	float	dC3;				//
	float	dIC4;				//
	float	dNC4;				//
	float	dIC5;				//
	float	dNC5;				//
	float	dCO2;				//
	int		nCH;				//
	CString strFileName;
};

class CResultRecordView : public CFormView
{
	DECLARE_DYNCREATE(CResultRecordView)

public:
	CResultRecordView();           // 动态创建所使用的受保护的构造函数
	virtual ~CResultRecordView();

public:
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_CResultRecordView };
#endif
#ifdef _DEBUG
	virtual void AssertValid() const;
#ifndef _WIN32_WCE
	virtual void Dump(CDumpContext& dc) const;
#endif
#endif
	CHisChromG	m_wndHisCurve;
	CGridCtrl	m_Grid;
	CButton m_btDate;
	CButton m_btReturn;
	CButtonST m_btGrid;
	CButtonST m_btTrend;
	CButton m_btToBegin;
	CButton m_btToEnd;
	CButton m_btUp;
	CButton m_btDown;
	CComboBox m_cmbVS;
	CComboBox m_cmbHS;

private:
	int		m_nCurMode;		//0--表格，1--趋势图
	int		m_nVSType;		//0----0.0001--1%
							//1----0.001 - 100 %
							//2----0.001 - 10 %
							//3----0.001 - 1 %
	int		m_nHSType;		//0--24h;1--12h;2--6h;3--2h；4--1小时
	CTime   m_tStartTime;
	int		m_nTimeSpan;

	CTime	m_tDbStartTime;
	CTime   m_tDbEndTime;
	CArray<CHROM_RESULT, CHROM_RESULT&> arrChromResult;	
	CDib	m_dibChecked;				//显示
	CRect	m_rtCheck[9];				//曲线显示标记区域
	CRect	m_rtGraph;					//趋势图区域
	int		m_nXScale;					//X轴范围
	int		m_nVLogNums;				//Y轴对数分隔数
	float	m_dVMinVal;					//Y轴最小值
	float	m_dVMaxVal;					//Y轴最大值

private:
	void	UpdateView();
	void	InitGrid();
	void	FillGrid();
	int		LoadHisData();
	void	Draw(CDC* pDC, CRect rt);
	void	DrawGraphControl(CRect rt, CDC *pDC);
	void	DrawFrame(CRect rt, CDC *pDC);
	void	DrawCurve(CRect rt, CDC *pDC);

public:
	void	RelayOut();

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnPaint();
	virtual void OnInitialUpdate();
	afx_msg void OnBnClickedBtdate();
	afx_msg void OnBnClickedBtnow();
	afx_msg void OnBnClickedBtgrid();
	afx_msg void OnBnClickedBttrend();
	afx_msg void OnCbnSelchangeCmbvs();
	afx_msg void OnCbnSelchangeCmbhs();
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnGridClick(NMHDR *pNotifyStruct, LRESULT* pResult);
	afx_msg void OnBnClickedBttop();
	afx_msg void OnBnClickedBtbottom();
	afx_msg void OnBnClickedBtup();
	afx_msg void OnBnClickedBtdown();
};


